package test.lyj.model;

import test.lyj.tool.Tool;


import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
/**
 * 另外一个线程 
 * 这个线程等线程1结束后,启动并处理一些事情
 * @author leo
 *
 */ 
public class AnotherActivityThread extends Thread {
	Handler messageListener;
	private int loadingSecond;
	
	public AnotherActivityThread(Handler listener,int loadingSecond){
		this.messageListener=listener;
		this.loadingSecond=loadingSecond;
	}
	@Override
	public State getState() {
		// TODO Auto-generated method stub
		return super.getState();
	}

	@Override
	public void run() {
		int time=0;
		try {
			while (time < loadingSecond) {
				time++;
				Message message = new Message();
				message.what = Tool.TIMER_TASK_INFO;
				Bundle b = new Bundle();
				b.putString(Tool.TIMER_TASK_RESULT, String
						.valueOf(time));
				message.setData(b);
				messageListener.sendMessage(message);

				Thread.sleep(500);
			}
		} catch (InterruptedException e) {

		}
	}

}
